Static Arrays
Static arrays (ARRAY) are declared using the same method as used for variables, except that a series of storage locations is allocated for the array values, rather than a single location typical of a variable. Static array declarations occur in the VAR block along with other variables.
Static arrays come in one- and two-dimensional varieties. The general syntax for one-dimensional static arrays is:
<identifier> : ARRAY [ m..n ] OF <data type>;
In the array declaration, the term [m..n] indicates the dimension, or size, of the array. An array declared with a dimension of [1..10] will allocate ten contiguous storage locations in memory. Static arrays support any valid fundamental data type, as well as the user-defined STRUCTURE type (see Creating Structures for details).
To retrieve a value from an element of a one-dimensional array, the same bracket notation described earlier is used. The array name should appear to the left of the brackets, and a non-negative INTEGER value representing the array index should appear within the brackets:
 
j := values[3];
values[23] := 15.5;
total := price[i] + tax;
An array index may be any constant non-negative INTEGER value or expression which resolves to such a value.
The following example illustrates the practical use of a one-dimensional array:
 
In the example, a ten element array of STRING is declared, and the script code begins with assignment of values to the elements of the array. In the assignments, constants are used to represent the array indices, but a variable or other identifier which evaluates to an INTEGER value could have been used in their place. Such an identifier is used later in the Concat() function call to reference array elements.
Two-dimensional static arrays extend the syntax of a one-dimensional array by adding an additional array index to the declaration:
<identifier> : ARRAY [ m..n,r..s ] OF <data type>;
In the declaration for the two-dimensional array, the first index value defines the number of “rows” in the array, while the second index defines the number of “columns.” In such a two-dimensional array, n x s contiguous storage locations will be allocated to hold data values (when m and r are 1).
Accessing an element in a two-dimensional array is not very different from a one-dimensional array:
j := values[3,5];
values[23,1] := 15.5;
total := price[i,j] + tax;
If we think of the two-dimensional array in terms of rows and columns, we would use two index values to indicate the row and column position of the array element to be indexed.

Arrays in VectorScript : Static Arrays

Nemetschek NA
Phone: 410.290.5114
Fax: 410.290.8050